Skip to content

Customer Facing Statsbeat: Added logic for dropped item count #41950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 9, 2025

Conversation

rads-1996
Copy link
Member

Description

Follow up PR to #41669. This PR includes changes for dropped item counts

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 22:50
@github-actions github-actions bot added the Monitor - Exporter Monitor OpenTelemetry Exporter label Jul 8, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds logic for tracking and reporting dropped telemetry items alongside existing success metrics, including:

  • Implementation of count_dropped_items, _item_drop_callback, and _get_drop_reason in CustomerStatsbeat.
  • New utility functions categorize_exception_message and categorize_status_code for low-cardinality drop reasons.
  • Expanded test suite in test_customer_statsbeat.py to validate dropped item counting.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/statsbeat/test_customer_statsbeat.py Added tests and helpers for dropped item counts but missing import of _TYPE_MAP.
statsbeat/_customer_statsbeat.py Introduced count_dropped_items, drop counters, and observation callbacks.
exporter/_utils.py Added categorize_exception_message and categorize_status_code utilities.
exporter/_constants.py Adjusted envelope name mapping for dependencies in _TYPE_MAP.
Comments suppressed due to low confidence (3)

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py:404

  • Consider adding a docstring describing the purpose, input, and output of categorize_exception_message for clarity and consistency with the rest of the utility functions.
def categorize_exception_message(exception_message: str) -> str:

sdk/monitor/azure-monitor-opentelemetry-exporter/tests/statsbeat/test_customer_statsbeat.py:46

  • The test references _TYPE_MAP but it is not imported. Please add from azure.monitor.opentelemetry.exporter._constants import _TYPE_MAP (or the correct module) at the top of this test file.
            for envelope_name, telemetry_type in _TYPE_MAP.items()

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py:170

  • The _TYPE_MAP key for dependencies should match the actual envelope name with Data suffix. Replace _REMOTE_DEPENDENCY_ENVELOPE_NAME with _REMOTE_DEPENDENCY_ENVELOPE_DATA to correctly map RemoteDependencyData envelopes.
                _REMOTE_DEPENDENCY_ENVELOPE_NAME: _DEPENDENCY,

@rads-1996
Copy link
Member Author

Screenshot 2025-07-08 143902

Screenshot 2025-07-08 143933

@lzchen
Copy link
Member

lzchen commented Jul 9, 2025

Please add a CHANGELOG entry!

@rads-1996 rads-1996 merged commit f75f82c into main Jul 9, 2025
19 checks passed
@rads-1996 rads-1996 deleted the rads-1996/dropped-items branch July 9, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor - Exporter Monitor OpenTelemetry Exporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants